package com.example.littleSpider.myapplication.activity;

import android.graphics.Rect;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.example.littleSpider.myapplication.R;
import com.example.littleSpider.myapplication.adapter.BuyingSpreeAdapter;
import com.example.littleSpider.myapplication.adapter.MySaleItemDecoration;
import com.example.littleSpider.myapplication.base.BaseActivity;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;
import es.dmoral.toasty.Toasty;

/**
 * Created by littleSpider on 2017/12/19.
 */

public class SalesReturnActivity extends BaseActivity{

    @BindView(R.id.recycler_view)
    RecyclerView mRecyclerView;

    @Override
    protected int getLayoutRes() {
        return R.layout.activity_sales_return;
    }

    @Override
    protected void initView() {
        List<String> datas = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            datas.add("");
        }
        BuyingSpreeAdapter adapter = new BuyingSpreeAdapter(R.layout.item_sales_return_and_refund, datas);
        mRecyclerView.setAdapter(adapter);
        mRecyclerView.setLayoutManager(new LinearLayoutManager(SalesReturnActivity.this));
        //设置RecyclerView的item装饰器
        mRecyclerView.addItemDecoration(new MySaleItemDecoration());

        adapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
            @Override
            public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
                Toasty.warning(SalesReturnActivity.this, "Look me!").show();
            }
        });
    }

    @Override
    protected void initData() {

    }

    @OnClick(R.id.rl_back)
    public void back(){
        finish();
    }
}
